package com.example.servicegateway.route.rule.validator.impl;

import com.example.servicegateway.route.rule.validator.AddRuleValidator;

import java.util.ArrayList;
import java.util.List;

/**
 * 使用本地缓存校验
 * @author K
 */
public class LocalAddRuleValidator implements AddRuleValidator {

    private List<String> list = new ArrayList<>();

    @Override
    public boolean isAllMatchServiceNams(List<String> serviceNames) {
        if (list.containsAll(serviceNames)) {
            return true;
        }

        list.clear();
        list.addAll(serviceNames);
        return false;
    }
}
